package collection1;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

public class CollectionToArray {
    public static void main(String[] args) {
        Collection<String>c1=new ArrayList<>();
        c1.add("one");
        c1.add("teo");
        c1.add("three");
        c1.add("four");
        c1.add("five");
        System.out.println(c1);
        String[] array1=c1.toArray(new String[c1.size()]);
        System.out.println(Arrays.toString(array1));



        Collection<Integer> c2=new ArrayList<>();
        c2.add(10);
        c2.add(11);
        c2.add(8);
        System.out.println(c2);
        Integer[] array2=c2.toArray(new Integer[c2.size()]);
        System.out.println(Arrays.toString(array2));
    }
}
